home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_02_09 / 2n09067a < prev    next >
Text File  |  1991-07-24  |  4KB  |  107 lines

  1. // SAMPLE25.L - Demonstrate Predefined and Custom Cursors.
  2.  
  3. main
  4. {
  5.     window ();
  6.     w.menu = new menu
  7.         << new menuitem ("&Arrow")
  8.         << new menuitem ("&Wait")
  9.         << new menuitem ("&Cross")
  10.         << new menuitem ("&Ibeam")
  11.         << new menuitem ("Ic&on")
  12.         << new menuitem ("Si&ze")
  13.         << new menuitem ("Size&NESW")
  14.         << new menuitem ("SizeN&S")
  15.         << new menuitem ("SizeNWS&E")
  16.         << new menuitem ("Size&WE")
  17.         << new menuitem ("&UpArrow")
  18.         << new menuitem ("Cur&1")
  19.         << new menuitem ("Cur&2");
  20.  
  21.     cur1 = new cursor <<
  22.         "xbbbbbb                         " <<
  23.         "bbbbbb                          " <<
  24.         "bbbbb                           " <<
  25.         "bbbbb                           " <<
  26.         "bbbbbb                          " <<
  27.         "bb  bbb                         " <<
  28.         "b    bbb                        " <<
  29.         "      bbb                       " <<
  30.         "       bbb                      " <<
  31.         "        bbb                     " <<
  32.         "         bbb                    " <<
  33.         "          bbb                   " <<
  34.         "           bbb                  " <<
  35.         "            bbb                 " <<
  36.         "                                " <<
  37.         "              bbb               " <<
  38.         "                                " <<
  39.         "                bbb             " <<
  40.         "                                " <<
  41.         "                  bbb           " <<
  42.         "                                " <<
  43.         "                    bbb         " <<
  44.         "                                " <<
  45.         "                      bbb       " <<
  46.         "                                " <<
  47.         "                        bbb     " <<
  48.         "                                " <<
  49.         "                          bbb   " <<
  50.         "                                " <<
  51.         "                            bbb " <<
  52.         "                                " <<
  53.         "                             bbb";
  54.  
  55.     cur2 = new cursor (15, 0) <<
  56.         "               x                " <<
  57.         "              bib               " <<
  58.         "             bi ib              " <<
  59.         "            bi   ib             " <<
  60.         "           bi     ib            " <<
  61.         "          bi       ib           " <<
  62.         "         bi         ib          " <<
  63.         "        bi           ib         " <<
  64.         "       bi             ib        " <<
  65.         "      bi               ib       " <<
  66.         "     bi                 ib      " <<
  67.         "    bi                   ib     " <<
  68.         "   bi                     ib    ";
  69. }
  70.  
  71. set_cursor (string name, any cursor)
  72. {
  73.     cur_cursor = name;
  74.     w.cursor = cursor;
  75. }
  76.  
  77. wait     {set_cursor ("wait",     "wait");}
  78. arrow    {set_cursor ("arrow",    "arrow");}
  79. cross    {set_cursor ("cross",    "cross");}
  80. ibeam    {set_cursor ("ibeam",    "ibeam");}
  81. icon     {set_cursor ("icon",     "icon");}
  82. size     {set_cursor ("size",     "size");}
  83. sizenesw {set_cursor ("sizenesw", "sizenesw");}
  84. sizens   {set_cursor ("sizens",   "sizens");}
  85. sizenwse {set_cursor ("sizenwse", "sizenwse");}
  86. sizewe   {set_cursor ("sizewe",   "sizewe");}
  87. uparrow  {set_cursor ("uparrow",  "uparrow");}
  88. cur1     {set_cursor ("cur1",     cur1);}
  89. cur2     {set_cursor ("cur2",     cur2);}
  90. cur3     {set_cursor ("cur3",     cur3);}
  91. cur4     {set_cursor ("cur4",     cur4);}
  92. cur5     {set_cursor ("cur5",     cur5);}
  93. cur6     {set_cursor ("cur6",     cur6);}
  94.  
  95. paint {w.roundrectangle (50, 50, w.width - 50, w.height - 50, 50, 50);}
  96.  
  97. position (x, y) {w.home; w << x+","+y+"  "+cur_cursor+"     ";}
  98.  
  99. click (x, y)
  100. {
  101.     // Can't draw predefined cursors.
  102.     if (w.cursor.isa ("string"))
  103.         beep ();
  104.     else
  105.         w.cursor.draw (w, x, y);
  106. }
  107.